/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.os.dao.zakharov.oracle;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Date;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Zakharov
 */
@Entity
@Table(name = "APPLICATION")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Application.findAll", query = "SELECT a FROM Application a"),
    @NamedQuery(name = "Application.findByIdApplication", query = "SELECT a FROM Application a WHERE a.idApplication = :idApplication"),
    @NamedQuery(name = "Application.findByNameAppliction", query = "SELECT a FROM Application a WHERE a.nameAppliction = :nameAppliction"),
    @NamedQuery(name = "Application.findByDescriptionApplication", query = "SELECT a FROM Application a WHERE a.descriptionApplication = :descriptionApplication"),
    @NamedQuery(name = "Application.findByPublicationDate", query = "SELECT a FROM Application a WHERE a.publicationDate = :publicationDate"),
    @NamedQuery(name = "Application.findByOperationSystems", query = "SELECT a FROM Application a WHERE a.operationSystems = :operationSystems"),
    @NamedQuery(name = "Application.findByPrice", query = "SELECT a FROM Application a WHERE a.price = :price")})
public class Application implements Serializable {
    
    private static final long serialVersionUID = 1L;
    
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "ID_APPLICATION")
    private BigDecimal idApplication;
    
    @Size(max = 30)
    @Column(name = "NAME_APPLICTION")
    private String nameAppliction;
    
    @Size(max = 30)
    @Column(name = "DESCRIPTION_APPLICATION")
    private String descriptionApplication;
    
    @Column(name = "PUBLICATION_DATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date publicationDate;
    
    @Size(max = 20)
    @Column(name = "OPERATION_SYSTEMS")
    private String operationSystems;
    
    @Column(name = "PRICE")
    private BigInteger price;
    
    @JoinColumn(name = "ID_USER", referencedColumnName = "ID_USER")
    @ManyToOne
    private Users idUser;

    public Application() {
    }

    public Application(BigDecimal idApplication) {
        this.idApplication = idApplication;
    }

    public BigDecimal getIdApplication() {
        return idApplication;
    }

    public void setIdApplication(BigDecimal idApplication) {
        this.idApplication = idApplication;
    }

    public String getNameAppliction() {
        return nameAppliction;
    }

    public void setNameAppliction(String nameAppliction) {
        this.nameAppliction = nameAppliction;
    }

    public String getDescriptionApplication() {
        return descriptionApplication;
    }

    public void setDescriptionApplication(String descriptionApplication) {
        this.descriptionApplication = descriptionApplication;
    }

    public Date getPublicationDate() {
        return publicationDate;
    }

    public void setPublicationDate(Date publicationDate) {
        this.publicationDate = publicationDate;
    }

    public String getOperationSystems() {
        return operationSystems;
    }

    public void setOperationSystems(String operationSystems) {
        this.operationSystems = operationSystems;
    }

    public BigInteger getPrice() {
        return price;
    }

    public void setPrice(BigInteger price) {
        this.price = price;
    }

    public Users getIdUser() {
        return idUser;
    }

    public void setIdUser(Users idUser) {
        this.idUser = idUser;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idApplication != null ? idApplication.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Application)) {
            return false;
        }
        Application other = (Application) object;
        if ((this.idApplication == null && other.idApplication != null) || (this.idApplication != null && !this.idApplication.equals(other.idApplication))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.os.dao.zakharov.oracle.Application[ idApplication=" + idApplication + " ]";
    }
    
}
